<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'create-query',
    'type'=>'horizontal',
    'enableClientValidation'=>true,
    'clientOptions'=>array(
        'validateOnSubmit'=>true,
    ),
)); ?>
 
<div id="conditionDialog"></div>
<fieldset>
 
    <legend><?php echo $model->isNewRecord? '新增查询' : '修改查询' ?> </legend>
    <?php echo $form->errorSummary($model); ?>
    <?php echo $form->textFieldRow($model, 'job_name'); ?>
    <?php echo $form->dropDownListRow($model, 'res_id', Resource::listItems(ResourceType::Log)); ?>
    <?php echo $form->textFieldRow($model, 'query_select'); ?>

    <?php echo $form->textFieldRow($model, 'query_condition', array('hint'=>'设置'.CHtml::ajaxLink('查询条件',$this->createUrl('job/condition'),array(
        'onclick'=>'$("#conditionDialog").dialog("open"); return false;',
        'update'=>'#conditionDialog'
        ),array('id'=>'showConditionDialog'))
)); ?>

    <?php echo $form->dropDownListRow($model, 'job_priority', Priority::$labels); ?>
    <?php echo $form->textFieldRow($model, 'output_name', array('hint'=>'查询结果的名称，请用变量命名方式，不支持中文字符。')); ?>
    <?php echo $form->radioButtonListRow($model, 'system_id', StorageSystem::listItems(array(PhysicalType::Database, PhysicalType::RemoteFile)), array('hint'=>'<strong>注意:</strong> 结果将导出到指定的存储系统。')); ?>

</fieldset>
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'icon'=>'ok white', 'label'=>$model->isNewRecord ? '创 建' : '保 存')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'icon'=>'remove', 'label'=>'取 消')); ?>
</div>
<?php $this->endWidget(); ?>

